package com.atguigu.wc.transform;

import org.apache.flink.streaming.api.datastream.DataStream;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

/**
 * @Author:GaoFei
 * @Description:
 * @Date:Created in 18:11
 * @Modified By:
 */
public class PartitionTransform5 {
    public static void main(String[] args) throws Exception {
        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
        DataStream<String> stringDataStreamSource = env.readTextFile("D:\\1BIGDATA\\spark-streaming\\Flink\\src\\main\\resources\\hello.txt");
        // 1 - 4  rebelance  因为read是1，print是4
        stringDataStreamSource.print("input");
        // 4 - 4 随机打算
        stringDataStreamSource.shuffle();
        // 4 - 4 同一组的在一个分区
//        stringDataStreamSource.keyBy("");
        // 4 - 1 聚集所有数据到第一个分区
        stringDataStreamSource.global().print("global");
        env.execute();

    }
}
